package com.gnerv.sylvanas.business.manage.operation;

import com.gnerv.sylvanas.framework.core.BaseCurrentAccount;
import com.gnerv.sylvanas.business.manage.model.bo.RouteBO;
import com.gnerv.sylvanas.business.manage.model.dto.RouteDTO;
import com.gnerv.sylvanas.business.manage.model.dto.RouteTreeDTO;
import com.gnerv.sylvanas.business.manage.model.entity.Route;
import com.gnerv.sylvanas.business.manage.storage.RouteStorageService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
@Service
@AllArgsConstructor
public class RouteOperationService {

    private final RouteStorageService routeStorageService;
    private final BaseCurrentAccount baseCurrentAccount;

    
    public boolean create(RouteBO routeBO) {
        Route route = routeBO.toRoute();
        
        routeStorageService.insert(route);
        return true;
    }

    
    public boolean deleteByUkId(String ukId) {
        routeStorageService.deleteByUkId(ukId);
        return true;
    }

    
    public boolean updateByUkId(RouteBO routeBO) {
        Route route = routeBO.toRoute();
        route.setGmtModified();
        routeStorageService.updateByUkId(route);
        return true;
    }

    
    public RouteDTO selectByUkId(String ukId) {
        return routeStorageService.selectByUkId(ukId);
    }

    
    public List<RouteDTO> selectListByName(String name) {
        return routeStorageService.selectListByName(name);
    }

    
    public List<RouteDTO> selectListByParentUkId(String parentUkId) {
        return routeStorageService.selectListByParentUkId(parentUkId);
    }

    
    public List<RouteTreeDTO> selectListTreeByParentUkId(String parentUkId) {
        return routeStorageService.selectListTreeByParentUkId(parentUkId);
    }

}




